package com.hippo.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.hippo.core.config.annotation.RequiresPermissions;
import com.hippo.core.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: hippo
 */
@RestController
public class RecordController {

    @Autowired
    private RecordService recordService;

    @RequiresPermissions("record:list")
    @PostMapping("/getRecordList")
    public JSONObject getDingTalkConfigList(@RequestBody JSONObject data) {
        return recordService.getRecordList(data);
    }

    @PostMapping("/addRecord")
    public JSONObject addDingTalkConfig(@RequestBody JSONObject data) {
        return recordService.addRecord(data);
    }

    @RequiresPermissions("record:delete")
    @DeleteMapping("/deleteRecord/{id}")
    public JSONObject deleteDingTalkConfig(@PathVariable String id) {
        return recordService.deleteRecord(id);
    }

}
